#include <iostream>
#include <cstring>
using namespace std;

const int N = 100010;
int h[N], e[N * 2], ne[N * 2], idx = 0;
int q[N], l = 0, r = -1;
int color[N];
int n, m, a, b;
bool flag = true;

void add(int a, int b)
{
    e[idx] = b;
    ne[idx] = h[a];
    h[a] = idx++;
    return;
}

int bfs(int x)
{
    color[x] = 1;
    q[++r] = x;
    while (r >= l)
    {
        int now = q[l++];
        for (int i = h[now]; i != -1; i = ne[i])
        {
            int j = e[i];
            if (color[j] == color[now])
            {
                return false;
            }
            else if (!color[j])
            {
                color[j] = -color[now];
                q[++r] = j;
            }
        }
    }
    return true;
}
int main()
{
    memset(h, -1, sizeof h);
    memset(color, 0, sizeof color);
    cin >> n >> m;
    while (m--)
    {
        cin >> a >> b;
        add(a, b);
        add(b, a);
    }
    for (int i = 1; i <= n; ++i)
        if (!bfs(i))
        {
            flag = false;
            break;
        }
    if (flag)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}